package com.bds.btcdc.web.utils;


import com.bds.btcdc.web.model.strategy.ExchangeTransaction;

import java.math.BigDecimal;
import java.util.Comparator;

/**
 * Created by DongChenchen on 2018/5/2 0002
 */
public class ComparatorUtils {
    public static Comparator<ExchangeTransaction> comparator1=new Comparator<ExchangeTransaction>() {
        @Override
        public int compare(ExchangeTransaction o1, ExchangeTransaction o2) {
            //降序排序
            int size1 = o1.getTransactions().size();
            int size2 =o2.getTransactions().size();
            return size1==size2?0:(size1>size2?-1:1);
        }
    };

    public static Comparator<ExchangeTransaction> comparator2=new Comparator<ExchangeTransaction>() {
        @Override
        public int compare(ExchangeTransaction o1, ExchangeTransaction o2) {
            //降序排序
            BigDecimal scale1 = o1.getCoin_scale();
            BigDecimal scale2 = o2.getCoin_scale();
            int result = scale1.compareTo(scale2);
            return result==0?0:(result==1?-1:1);
        }
    };
    public static Comparator<ExchangeTransaction> comparator3=new Comparator<ExchangeTransaction>() {
        @Override
        public int compare(ExchangeTransaction o1, ExchangeTransaction o2) {
            //升序排序
            BigDecimal scale1 = o1.getCoin_scale();
            BigDecimal scale2 = o2.getCoin_scale();
            return scale1.compareTo(scale2);
        }
    };
//    public static Comparator<ExchangeTransaction> comparator2=new Comparator<ExchangeTransaction>() {
//        @Override
//        public int compare(ExchangeTransaction o1, ExchangeTransaction o2) {
//            //降序排序
//            BigDecimal scale1 = o1.getMoney_scale();
//            BigDecimal scale2 = o1.getMoney_scale();
//            int result = scale1.compareTo(scale2);
//            return result==0?0:(result==1?-1:1);
//        }
//    };
}
